﻿@model sBlog.Net.Models.BlogPostPageViewModel
<script type="text/javascript">
    var intPage = 1;
    var noCache = new Date().toString();
    $(window).scroll(function () {
        $('#container').masonry('reload');
        if ($(window).scrollTop() + $(window).height() > $(document).height() - 150) {
            intPage = intPage + 1;
            $.getJSON('/Home/LoadMoreData?pageNumber=' + intPage, { noCache: noCache }, function (data) {
                $('#container').append(data).fadeIn();
                $('#container').masonry('reload');
            });
        }
    });

    $(function () {
        $('#container').masonry({
            columnWidth: 333,
            itemSelector: '.postHome'
        }).imagesLoaded(function () {
            $('#container').masonry('reload');
        });
    });
</script>
<div class="dvBlogListItem" id="container">
    @foreach (var post in Model.Posts)
    {   
        @Html.Partial("PostHome", post);
    }
</div>
